---
category: Array
created: '2020-04-19'
title: Empty an array
updated: '2021-10-22'
---

**JavaScript version**

```js empty.js
const empty = (arr) => (arr.length = 0);

// Or
arr = [];
```

**TypeScript version**

```ts empty.ts
const empty = <T,_>(arr: T[]) => (arr.length = 0);

// Or
arr = [];
```
